package com.belizer.demo.str;

import org.openjdk.jol.info.ClassLayout;

import java.io.IOException;

public class Demo3 {


    private static String str = "12340123328123085L";
    private static Long l = 12340123328123085L;


    public static void main(String[] args) throws IOException {
        //创建对象
        String str = "12340123328123085L";
        Long l = 12340123328123085L;

        long size = ClassLayout.parseInstance(str).instanceSize();
        long size2 = ClassLayout.parseInstance(l).instanceSize();
        System.out.println("str 占用内存：" + size);
        System.out.println("l 占用内存：" + size2);

        System.in.read();
    }
}
